package com.atguigu.gulimall.product.web;

import com.atguigu.gulimall.product.service.SkuInfoService;
import com.atguigu.gulimall.product.vo.SkuItemVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @ ClassName ItemController
 * @ Description TODO
 * @ Author admin
 * @ Date 2021/3/16 15:05
 * @ Version 1.0
 */
@Controller
public class ItemController {

    @Autowired
    SkuInfoService skuInfoService;

    @GetMapping("/{skuId}.html")
    public String itemController(@PathVariable Long skuId, Model mode){

        SkuItemVo skuItemVo = skuInfoService.item(skuId);

        mode.addAttribute("item",skuItemVo);
        mode.addAttribute("currentTime",System.currentTimeMillis());

        return "item";
    }
}
